//
//  ColorManger.m
//  04 - homeWork NSDictionary
//
//  Created by 韩旭 on 16/7/7.
//  Copyright © 2016年 基础. All rights reserved.
//
#import "Color.h"
#import "ColorManger.h"

@implementation ColorManger
- (instancetype)init {
    self = [super init];
    if (self) {
        _colorManger = [[NSMutableDictionary alloc]init];
    }
    return self;
}
- (void)groupDic:(NSMutableDictionary *)colorDic {
    for (NSString *name in colorDic) {
        NSLog(@"%@",name);
        Color *color = [[Color alloc] init];
        color.name = name;
        color.colorValue = colorDic[name];
        NSString *initial = [name substringToIndex:1];
        NSMutableArray *colorArr = self.colorManger[initial];
        if (colorArr == nil) {
            colorArr = [NSMutableArray array];
            [self.colorManger setObject:colorArr forKey:initial];
        }
        [colorArr addObject:color];
    }
    NSLog(@"%@", self.colorManger);
}
- (NSMutableDictionary *)colorManger {
    return _colorManger;
}
@end
